<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>员工添加</title>
		<link rel="stylesheet" href="../static/css/ygtj.css">
	</head>
	<body>
		<div class="interface">
			<div>
				<form action="">
					<p class="left">姓名：</p><input class="name left-form"  placeholder="请输入姓名"  type="selected">
					<p class="right">性别：</p>
					<input class="gender right-form" type="radio" name="man" id="" value="0"><label  class="gender right-form" for="man">男</label>
					<input  class="gender right-form" type="radio" name="man" id="" value="1"><label  class="gender right-form" for="wman">女</label>
					<br>
					<p class="left">员工编号：</p><input class="emp_id left-form" placeholder="请输入员工编号"   type="selected">
					<p class="right">出生日期：</p><input class="birthday right-form" placeholder="2021-01-01"   type="selected">
					<br>
					<p class="left">身份证号：</p><input class="id_number left-form" placeholder="请输入省份证号"   type="selected">
					<p class="right">民族：</p><input class="nationality right-form" placeholder="请输入民族"   type="selected">
					<br>
					<p class="left">身高：</p><input class="height left-form" placeholder="请输入身高"   type="selected">
					<p class="right">体重：</p><input class="weight right-form" placeholder="请输入体重"   type="selected">
					<br>
					<p class="left">电话：</p><input class="phone left-form" placeholder="请输入电话"   type="selected">
					<p class="right">学历：</p><input class="edu right-form" placeholder="输入学历"   type="selected">	
					<br>
					<p class="left">住址：</p><input class="address left-form" placeholder="请输入住址"   type="selected">
					<p class="right">婚姻状态：</p>
					<input class="marriage right-form" type="radio" name="marriage" id="" value="0"><label  class="marriage right-form" for="married">已婚</label>
					<input  class="marriage right-form" type="radio" name="marriage" id="" value="1"><label  class="marriage right-form" for="spinsterhood">未婚</label>
					<br>
					<p class="left">邮箱：</p><input class="email left-form" placeholder="请输入邮箱"   type="selected">
					<p class="right">入职时间：</p><input class="entry_date right-form" placeholder="2021-01-01"  type="selected">
					<br>
					<p class="left">岗位：</p><select class="post left-form"  id="">
						<option value="khb">客户部</option>
						<option value="cwb">财务部</option>
						<option value="xsb">销售部</option>
						<option value="reb">人事部</option>
						<option value="zc">老板</option>
					</select>
					<br>
					<input class="save" type="submit" value="保存">
					<input class="reset" type="reset" > 
				</form>
			</div>
		<script src="../static/js/jquery.min.js"></script>
		<script>
			function get_data(){
				// 获取数据
				var emp_id=$('.emp_id').val();
				var name=$('.name').val();
				var gender=$('.gender').val();
				var birthday=$('.birthday').val();
				var id_number=$('.id_number').val();
				var nationality=$('.nationality').val();
				var height=$('.height').val()
				var weight=$('.weight').val()
				var entry_date=$('.entry_date').val()
				var post=$('.post').val()
				var edu=$('.edu').val()
				var marriage=$('.marriage').val()
				var address=$('.address').val()
				var phone=$('.phone').val()
				var email=$('.email').val()
				// 发送格式json
				var post_data={
					'emp_id':emp_id,
					'name':name,
					'gender':gender,
					'birthday':birthday,
					'id_number':id_number,
					'nationality':nationality,
					'height':height,
					'weight':weight,
					'entry_date':entry_date,
					'post':post,
					'edu':edu,
					'marriage':marriage,
					'address':address,
					'phone':phone,
					'email':email,
				}
				// 向后端发送ajax请求
				$.ajax({
					url:'............',
					type:'post',
					data:JSON.stringify(post_data),
					contentType:'application/json',
					dataType:'post',
					success:function(res){
						if(res.code==200){
							alert("添加成功!");
						}else{
							alert(res.error)
						}
					}
				})
			}
		</script>
	</body>
</html>